﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>

<%
dim listid,pageid,id,rs,sql,title1,title2,title3,title4,title5,we0,zi,zi0,we,sou,dao,we4
		listid=Request.QueryString("listid")
		if not isnumeric(listid) then listid=0
		if listid="" then listid=0
		listid=clng(listid)
		pageid=Request.QueryString("pageid")
		if not isnumeric(pageid) then pageid=1
		if pageid="" then pageid=1
		pageid=clng(pageid)

		id=Request.QueryString("id")
		if not isnumeric(id) then id=0
		if id="" then id=0
		id=clng(id)
%>
<!--#include file="abc.asp"-->
<%
if sid="Null" then
%>
<%=title1%>
	<%=we%>你还没登陆,请先登陆。<%=we0%>
	<%=sou%><a href="/bbs/login.asp?sid=<%=sidd%>&amp;url=/bbs/showcont.asp?id=<%=id%>@@listid=<%=listid%>@@id=<%=id%>@@pageid=<%=pageid%>">马上登陆</a><%=we0%>
<%
elseif qingtian.qx("noadd", listid)=true then
		%>
		<card id="add" title="发表回复">
		<p align="left">
		<%=we%>出错啦!你已被禁止在本论坛发表帖子,有任何问题请联系管理员!<br/>
		<a href="viewv.asp?listid=<%=listid%>&amp;id=<%=id%>&amp;page=<%=pageid%>&amp;sid=<%=sidd%>">返回帖子</a><%=sou%>
		<%=dao%><a href="board.asp?listid=<%=listid%>&amp;page=<%=pageid%>&amp;sid=<%=sidd%>">返回论坛</a><%=we0%>
		<%
else

Set Rs = Server.CreateObject("Adodb.Recordset")
Sql = "select [lock] from qingtian_bbs_forum where [del]=0 and id="&id
Rs.Open Sql,conn,1,1
if not (rs.bof and rs.eof)  then
	if rs("lock") =true then
	%>
<%=title3%>
	<%=we%>本帖已经被锁定!<br/>
	-------------<br/>
	<a href="viewv.asp?id=<%=id%>&amp;listid=<%=listid%>&amp;pageid=<%=pageid%>&amp;sid=<%=sidd%>">返回帖子</a><%=we0%><%=sou%>
	<a href="board.asp?listid=<%=listid%>&amp;page=<%=pageid%>&amp;sid=<%=sidd%>">返回论坛</a><%=we0%>
	<%
	else

		IF  Request.QueryString("Action")="save" Then
			call save
		else
			call index
		end if
	end if

else
	%>
<%=title2%>
	<%=we%>没有该帖子!<br/>
	-------------<br/>
	<a href="board.asp?listid=<%=listid%>&amp;page=<%=pageid%>&amp;sid=<%=sidd%>">返回论坛</a><%=we0%>
	<%
end if
Rs.close
Set rs = Nothing

end if
End Function

Function index
dim listid,id,pageid
		listid=Request.QueryString("listid")
		if not isnumeric(listid) then listid=0
		if listid="" then listid=0
		listid=clng(listid)

		id=Request.QueryString("id")
		if not isnumeric(id) then id=0
		if id="" then id=0
		id=clng(id)


		pageid=Request.QueryString("pageid")
		if not isnumeric(pageid) then pageid=1
		if pageid="" then pageid=1
		pageid=clng(pageid)


	dim rs,sql,name
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "SELECT [name]  FROM [qingtian_bbs] where [del]=0 and [view]=0 and [id]="&listid
	Rs.Open Sql,conn,1,1
	if not (rs.bof and rs.eof)  then
		name=qingtian.utf8(rs("name"))
	end if
	Rs.close
	Set rs = Nothing
%>
<!--#include file="abc.asp"-->
<%=title2%>
	<%=book%>
		<%=we%><a href="upad.asp?listid=<%=listid%>&amp;reid=<%=id%>&amp;pageid=<%=pageid%>&amp;sid=<%=sidd%>">回复上传文件帖</a><br/>
-------------<br/>
<a href="viewv.asp?id=<%=id%>&amp;listid=<%=listid%>&amp;pageid=<%=pageid%>&amp;sid=<%=sidd%>">返回帖子</a><%=we0%><%=sou%>
<a href="board.asp?listid=<%=listid%>&amp;page=<%=pageid%>&amp;sid=<%=sidd%>"><%=name%>论坛</a><%=we0%>

<%
End Function


Function save

dim listid,id,pageid,zz,td,hua,huaa
		listid=Request.QueryString("listid")
		if not isnumeric(listid) then listid=0
		if listid="" then listid=0
		listid=clng(listid)
		id=Request.QueryString("id")
		if not isnumeric(id) then id=0
		if id="" then id=0
		id=clng(id)
		td=Request.QueryString("t")
		if td="" then td=0

		pageid=Request.QueryString("pageid")
		if not isnumeric(pageid) then pageid=1
		if pageid="" then pageid=1
		pageid=clng(pageid)
%>
<!--#include file="abc.asp"-->
<%
		Set Rs = Server.CreateObject("Adodb.Recordset")
		if DATEDIFF("s", session("addtime"), now()) >600 then
		session("addtime")=now
		session("addcount")=0
		end if
		content=qingtian.repsql(Request.form("content"))
                face=Request.form("face")
		if not isnumeric(face) then face=0
		if face="" then face=0
		face=clng(face)
                if face<>0 then content="[img]../img/"&face&".gif[/img]"+content
		select case td
		case "1"
		content="我顶"
		case "2"
		content="支持你"
		case "3"
		content="反对你"
		End Select
	IF content<>"" and session("repBoard")<>content and session("addcount")<5  then
		dim name,content,rs,nid,ip,reid,sql
		ip=Request.ServerVariables("REMOTE_ADDR")

                huaa=qingtian.inlof("huaa")
                hua=qingtian.inlof("hua")

		Sql = "select [id],[zf],[money] FROM qingtian_user where [sid]='"&md5(sid) & md5(strReverse(sid))&"'"
		Rs.Open Sql,conn,1,3
		if not (rs.eof and rs.bof) then
			nid=rs("id")
			rs("zf")=rs("zf")+huaa
			rs("money")=rs("money")+hua
			rs.update
		else
			nid=0
		end if
		Rs.close

		%>
<%=title4%><%=we%>
		<%
		Sql = "select top 1  [time] FROM qingtian_bbs_reforum where   [content]='"&content&"' order by [id] desc"
		Rs.Open Sql,conn,1,1
		if not (rs.eof and rs.bof) then
			if DATEDIFF("s", rs("time"), now()) > 60*60 then
			zz=0
			else
			zz=1
			end if
		else
			zz=0
		end if
		Rs.close

		if zz=0 then

		Sql = "select [nid],[topicid],[content],[ip] FROM qingtian_bbs_reforum"
		Rs.Open Sql,conn,1,3
		rs.addnew
		rs("nid")=nid
		rs("topicid")=id
		rs("content")=content
		rs("ip")=ip
		rs.update
		Rs.close
		Sql = "select [reply],[reptime] FROM qingtian_bbs_forum  where [id]="&id&""
		Rs.Open Sql,conn,1,3
		if not (rs.eof and rs.bof) then
		rs("reply")=rs("reply")+1
		rs("reptime")=now()
		rs.update
		end if
		Rs.close
		Sql = "select top 1 [id] from [qingtian_bbs_reforum] where nid="&nid&" order by [id] desc"
		Rs.Open Sql,conn,1,1
		if not (rs.eof and rs.bof) then
		reid=rs("id")
		end if
		Rs.close
		session("repBoard")=content
		if session("addtime")<>"" then
		if DATEDIFF("s", session("addtime"), now()) >20 then
		session("addtime")=now
		session("addcount")=1
		else
		session("addtime")=now
		session("addcount")=session("addcount")+1
		end if
		else
		session("addtime")=now
		session("addcount")=1
		end if

		if session("addcount")>2 then
		%>你好,请注意一下了..你已经一口气回复了<%=session("addcount")%>帖了.<br/><%
		end if

		%>发表回复成功.<br/>你的积分增加<%=zi%><%=huaa%><%=zi0%>，你的<%=qingtian.bi%>增加<%=zi%><%=hua%><%=zi0%>，今日系统剩余<%=qingtian.bi%>:<%=zi%><%=qingtian.inlof("mot")%><%=zi0%>。<%=we0%><%=sou%>
		<%

		else
		%>请不要发重复的帖!<br/><%
		end if

	else%>
<%=title5%><%=we%>
		<%if len(content)=0 then%>
		内容不能为空。<br/>
		<%elseif session("repBoard")=content then%>
		请不要重复提交。<br/>
		<%end if%>
		<%
		if session("addcount")>4 then
		%>你好,你好你的回复过快..请休息一下在回复,休息时间倒记时:<%=600-DATEDIFF("s", session("addtime"), now())%>秒.<br/><%
		end if
		%>
		<a href="showcont.asp?id=<%=id%>&amp;listid=<%=listid%>&amp;pageid=<%=pageid%>&amp;sid=<%=sidd%>">返回修改</a><br/>
	<%end if

	Sql = "SELECT [name],[logo],[flag],[bbs]  FROM [qingtian_bbs] where [del]=0 and [view]=0 and [id]="&listid
	Rs.Open Sql,conn,1,1
	if not (rs.bof and rs.eof)  then
		name=qingtian.utf8(rs("name"))
	end if
	Rs.close
	Set rs = Nothing

%>
-------------<br/>
<a href="viewv.asp?id=<%=id%>&amp;listid=<%=listid%>&amp;pageid=<%=pageid%>&amp;sid=<%=sidd%>">返回帖子</a><%=we0%><%=sou%>
<a href="board.asp?listid=<%=listid%>&amp;page=<%=pageid%>&amp;sid=<%=sidd%>"><%=name%>论坛</a><%=we0%>

<%
End Function
%>
